package com.sjn.camera;
import com.sjn.Template.composingRoom;
import com.sjn.camera.cameraFrame.AbstractFactory;
import com.sjn.camera.cameraFrame.FactoryProducer;
import com.sjn.res.egBlueprint.bluePrintdata;
import com.sjn.res.egBlueprint.bluePrintdemo;
import com.sjn.res.egBlueprint.egbluePrintcamera;
import com.sjn.res.egFoundry.*;
import com.sjn.res.make.MakeFactory;
import com.sjn.res.make.Makecamera;
import com.sjn.res.make.Makesth;
import com.sjn.util.encrytion.encryForblueprint;

import java.util.Scanner;


public class CameracomposingRoom extends composingRoom{
    //创建加密模块
    encryForblueprint encryForblueprint = new encryForblueprint();
    @Override
    public String Foundry(int i) {
        //开始选择代工厂
        if(i==1) {
            egFoundry egFoundry = Foundryitem.getcameraFoundry(new egFoundryCAMERA1());
            return egFoundry.getFoundryName();
        }
        else if(i==2){
            egFoundry egFoundry = Foundryitem.getcameraFoundry(new egFoundryCAMERA2());
            return egFoundry.getFoundryName();
        }
        else{
            return "输入有误,选择代工厂失败";
        }
    }


    @Override
    public String Blueprint(int x,int y,String technology) {
        //开始选择screen蓝图
        bluePrintdata b = new bluePrintdemo(x,y,encryForblueprint.getdata(technology),new egbluePrintcamera());

        return b.draw();
    }
    @Override
    public String Frameworks(int i) {
        Scanner sc = new Scanner(System.in);
        int j=0;
        //根据需求创建好工厂
        AbstractFactory abstractFactory = FactoryProducer.getFactory(i);
       //1选择定焦,CCD,2选择变焦,CMOS


        if (i==1) {


            System.out.println("-----创建镜头工厂成功!!-----");
            System.out.println("-----按1获得定焦镜头-----");
            System.out.println("-----按2获得变焦镜头-----");
            j = sc.nextInt();
            return abstractFactory.getLen(j);
        }
        else if (i==2){


            System.out.println("-----创建传感器工厂成功!!-----");
            System.out.println("-----按1获得CCD传感器-----");
            System.out.println("-----按2获得CMOS传感器-----");
            j = sc.nextInt();
           return abstractFactory.getSensor(j);
        }
        else {

            return "获取失败";
        }


    }
    @Override
    public String Production() {
        MakeFactory makeFactory = new MakeFactory();
        Makesth makecamera = makeFactory.getMake(new Makecamera());

        return makecamera.making();
    }
}
